package com.abc.app.tests;

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

import com.abc.app.pages.HomePage;
import com.abc.app.pages.LoginPage;


public class LoginTestSimple extends BaseTest{
	
	public LoginTestSimple(String browser, String os) {
		super(browser, os);
	}
	
	public LoginTestSimple() {
		super();
	}

	private WebDriver driver;
	
	@Test
	public void verifyHomePageTitle(){
		
		System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver_2.10_win32\\chromedriver.exe");
		
		Platform valueOf = Platform.valueOf("VISTA");
		System.out.println(valueOf);
		
		driver = new ChromeDriver();
		driver.get("https://login.comcast.net/login?ts=75248368&s=wnamp");
		
		waitt(1000);
		
		LoginPage loginPage = new LoginPage(driver);
		loginPage.setUsername("joseph.betty@comcast.net");
		loginPage.setPassword("comcast12345");
		HomePage homePage = loginPage.clickLoginButton();
		
		String pageTitle = homePage.getPageTitle();
		System.out.println(pageTitle);
		
		boolean loginSucess = StringUtils.contains(pageTitle, "XFINITY Connect: Inbox");
		
		waitt(2000);
		
		assertEquals(loginSucess, true);
		
		driver.close();
	}
}
